using System;
using QFramework;
using QGameFramework.Events;

namespace QGameFramework.Systems
{
    public interface IUISystem : ISystem
    {
    }

    public class UISystem : AbstractSystem, IUISystem
    {
        protected override void OnInit()
        {
            UIKit.Root.SetResolution(1920, 1080, 0);
            //注册事件
            this.RegisterEvent<OpenUIEvent>(e => { UIKit.OpenPanel(e.UIForm.ToString(), e.UILevel); });
            this.RegisterEvent<PushUIEvent>(e => { UIKit.Stack.Push(UIKit.GetPanel(e.UIForm.ToString())); });
            this.RegisterEvent<PopUIEvent>(e => { UIKit.Stack.Pop(); });
        }
    }
}